{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 量子传输和测量模块的展示\n",
    "\n",
    "在此我们用Qubiter编译/模拟器来展示如何通过一个中间量子比特（比特1）的协助，将一个量子比特（比特0）的纯态传输到另一个量子比特（比特2）。\n",
    "\n",
    "本文并不旨在讨论或展示量子传输背后的理论。对此感兴趣的读者可以很方便地在网上（维基或者课件）找到对于量子传输的简单推导。以量子传输为例，我们重点展示Qubiter的一些功能，例如测量模块（IF_M blocks）、打印输出，以及量子线路中各种密度矩阵的计算和画图功能。\n",
    "\n",
    "QUbiter也支持自动生成量子线路的语言文件。感兴趣的读者可以在此找到 <a href=\"../qubiter_rosetta_stone.pdf\"> Qubiter语言文件的详解</a>。\n",
    "\n",
    "\n",
    "在IBM公司一系列量子计算的展示文档中，也有文档分析了量子态传送的量子传输过程及其量子线路。这些文档是用IBM推出的 qasm 语言组织的，读者可以对qasm语言和Qubiter语言结构进行比较并选用自己喜欢的程序。另外，除了量子编译和量子仿真之外，Qubiter提供了将自身语言转换为IBM qasm语言的子程序，这样通过Qubiter编译后的量子线路可以直接在IBM的量子计算硬件上运行。对其他（例如Rigetti）编译语言和硬件的支持也正在进行中。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "首先添加工作目录到系统环境变量："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import sys\n",
    "print(os.getcwd())\n",
    "os.chdir('../../')\n",
    "print(os.getcwd())\n",
    "sys.path.insert(0,os.getcwd())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "导入需要的程序包："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "loaded OneBitGates, WITHOUT autograd.numpy\n"
     ]
    }
   ],
   "source": [
    "from qubiter.SEO_writer import *\n",
    "from qubiter.SEO_simulator import *\n",
    "from qubiter.StateVec import *\n",
    "from qubiter.Plotter import *\n",
    "import numpy as np\n",
    "# np.set_printoptions(precision=5)\n",
    "import pandas as pan\n",
    "import seaborn as sea; sea.set()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "初始化总量子比特数量 为 3，并且用直接的线路嵌入将3个量子比特映射到同样的3个量子比特。（在此我们用\"bit\"统称量子比特和经典比特）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "num_bits = 3\n",
    "emb = CktEmbedder(num_bits, num_bits)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "指定要写入的文件路径，并且采用（ZL-zero bit last）的惯例，即第0个比特在最后的顺序。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "file_prefix = 'teleportation-with-ifs'\n",
    "wr = SEO_writer(file_prefix, emb)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "将量子线路写入为语言文件及图像文件："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 对第 0 个量子比特旋转任意选取的某个角度，生成初始量子态\n",
    "wr.write_Rn(0, list(np.pi/180*np.array([20, 68, 46])))\n",
    "wr.write_PRINT(\"ALL\")\n",
    "\n",
    "# 对第 1 个量子比特施加Hadamard门 \n",
    "wr.write_H(1)\n",
    "# 对第 1、2 个量子比特施加CNOT门，生成bell基 \n",
    "wr.write_cnot(control_bit=1, target_bit=2)\n",
    "# wr.write_one_bit_gate(0, OneBitGates.rot_ax, [-np.pi/8, 2])\n",
    "wr.write_cnot(control_bit=0, target_bit=1)\n",
    "wr.write_H(0)\n",
    "wr.write_PRINT(\"ALL\")\n",
    "\n",
    "# 对量子比特 1、2 做测量\n",
    "wr.write_MEAS(0, kind=2)\n",
    "wr.write_MEAS(1, kind=2)\n",
    "\n",
    "wr.write_PRINT(\"ALL\")\n",
    "wr.write_IF_M_beg(Controls.new_knob(num_bits, 0, True))\n",
    "wr.write_Z(2)\n",
    "wr.write_IF_M_end()\n",
    "wr.write_PRINT(\"ALL\")\n",
    "wr.write_IF_M_beg(Controls.new_knob(num_bits, 1, True))\n",
    "wr.write_X(2)\n",
    "wr.write_IF_M_end()\n",
    "wr.write_PRINT(\"ALL\")\n",
    "    \n",
    "wr.close_files()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "生成的语言文件和图片文件都存储在 io_folder文件夹中：\n",
    "* <a href=\"../io_folder/teleportation-with-ifs_3_eng.txt\">../io_folder/teleportation-with-ifs_3_eng.txt</a>\n",
    "* <a href=\"../io_folder/teleportation-with-ifs_3_ZLpic.txt\">../io_folder/teleportation-with-ifs_3_ZLpic.txt</a>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "语言文件输出如下："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table style='font-family:monospace'><tr><td style='border-right:1px solid red;'>1</td><td style='text-align:left;'><pre>ROTN\t20.000000\t68.000000\t46.000000\tAT\t0</pre></td></tr><td style='border-right:1px solid red;'>2</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr><td style='border-right:1px solid red;'>3</td><td style='text-align:left;'><pre>HAD2\tAT\t1</pre></td></tr><td style='border-right:1px solid red;'>4</td><td style='text-align:left;'><pre>SIGX\tAT\t2\tIF\t1T</pre></td></tr><td style='border-right:1px solid red;'>5</td><td style='text-align:left;'><pre>SIGX\tAT\t1\tIF\t0T</pre></td></tr><td style='border-right:1px solid red;'>6</td><td style='text-align:left;'><pre>HAD2\tAT\t0</pre></td></tr><td style='border-right:1px solid red;'>7</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr><td style='border-right:1px solid red;'>8</td><td style='text-align:left;'><pre>MEAS\t2\tAT\t0</pre></td></tr><td style='border-right:1px solid red;'>9</td><td style='text-align:left;'><pre>MEAS\t2\tAT\t1</pre></td></tr><td style='border-right:1px solid red;'>10</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr><td style='border-right:1px solid red;'>11</td><td style='text-align:left;'><pre>IF_M(\t0T\t){</pre></td></tr><td style='border-right:1px solid red;'>12</td><td style='text-align:left;'><pre>SIGZ\tAT\t2</pre></td></tr><td style='border-right:1px solid red;'>13</td><td style='text-align:left;'><pre>}IF_M</pre></td></tr><td style='border-right:1px solid red;'>14</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr><td style='border-right:1px solid red;'>15</td><td style='text-align:left;'><pre>IF_M(\t1T\t){</pre></td></tr><td style='border-right:1px solid red;'>16</td><td style='text-align:left;'><pre>SIGX\tAT\t2</pre></td></tr><td style='border-right:1px solid red;'>17</td><td style='text-align:left;'><pre>}IF_M</pre></td></tr><td style='border-right:1px solid red;'>18</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "wr.print_eng_file(jup=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "输出图片文件，其中每一行都是和语言文件中一一对应的。\n",
    "\n",
    "这里时间箭头方向为下，由于我们采取了ZL惯例，第0个量子比特在最右边。\n",
    "\n",
    "另外，在对一个量子比特进行过测量之后（例如第九行），之前的\"|\"量子演化被\":\"符号所替代。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table style='font-family:monospace'><tr><td style='border-right:1px solid red;'>1</td><td style='text-align:left;'><pre>|   |   R</pre></td></tr><td style='border-right:1px solid red;'>2</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr><td style='border-right:1px solid red;'>3</td><td style='text-align:left;'><pre>|   H   |</pre></td></tr><td style='border-right:1px solid red;'>4</td><td style='text-align:left;'><pre>X---@   |</pre></td></tr><td style='border-right:1px solid red;'>5</td><td style='text-align:left;'><pre>|   X---@</pre></td></tr><td style='border-right:1px solid red;'>6</td><td style='text-align:left;'><pre>|   |   H</pre></td></tr><td style='border-right:1px solid red;'>7</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr><td style='border-right:1px solid red;'>8</td><td style='text-align:left;'><pre>|   |   M</pre></td></tr><td style='border-right:1px solid red;'>9</td><td style='text-align:left;'><pre>|   M   :</pre></td></tr><td style='border-right:1px solid red;'>10</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr><td style='border-right:1px solid red;'>11</td><td style='text-align:left;'><pre>IF_M(\t0T\t){</pre></td></tr><td style='border-right:1px solid red;'>12</td><td style='text-align:left;'><pre>Z   :   :</pre></td></tr><td style='border-right:1px solid red;'>13</td><td style='text-align:left;'><pre>}IF_M</pre></td></tr><td style='border-right:1px solid red;'>14</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr><td style='border-right:1px solid red;'>15</td><td style='text-align:left;'><pre>IF_M(\t1T\t){</pre></td></tr><td style='border-right:1px solid red;'>16</td><td style='text-align:left;'><pre>X   :   :</pre></td></tr><td style='border-right:1px solid red;'>17</td><td style='text-align:left;'><pre>}IF_M</pre></td></tr><td style='border-right:1px solid red;'>18</td><td style='text-align:left;'><pre>PRINT\tALL</pre></td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "wr.print_pic_file(jup=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "现在我们模拟制备一个初始态，其中所有量子态处于基态|0>，并且让模拟器从初态到末态演化。\n",
    "\n",
    "其中在量子线路中插入的“打印输出”功能会将在当时的量子线路状态打印输出到屏幕。每个输出指令都有对应的行代码来进行标识。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "*************************beginning PRINT output\n",
      "PRINT line number=2\n",
      "*********branch= pure\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(000)ZL ( 0.095871 + 0.541881j)\t prob=0.302826\n",
      "(001)ZL (-0.801041 + 0.235600j)\t prob=0.697174\n",
      "total probability of state vector (=one if no measurements)= 1.000000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (0.302826, 0.697174), 1: (1.0, -0.0), 2: (1.0, -0.0)}\n",
      "****************************ending PRINT output\n",
      "\n",
      "*************************beginning PRINT output\n",
      "PRINT line number=7\n",
      "*********branch= pure\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(000)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(100)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "(010)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "(110)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(001)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(101)ZL ( 0.400520 - 0.117800j)\t prob=0.174294\n",
      "(011)ZL ( 0.400520 - 0.117800j)\t prob=0.174294\n",
      "(111)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "total probability of state vector (=one if no measurements)= 1.000000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (0.5, 0.5), 1: (0.5, 0.5), 2: (0.5, 0.5)}\n",
      "****************************ending PRINT output\n",
      "\n",
      "*************************beginning PRINT output\n",
      "PRINT line number=10\n",
      "*********branch= 0T1T\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(011)ZL ( 0.400520 - 0.117800j)\t prob=0.174294\n",
      "(111)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (0.0, 1.0), 1: (0.0, 1.0), 2: (0.697174, 0.302826)}\n",
      "*********branch= 0T1F\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(001)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(101)ZL ( 0.400520 - 0.117800j)\t prob=0.174294\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (0.0, 1.0), 1: (1.0, 0.0), 2: (0.302826, 0.697174)}\n",
      "*********branch= 0F1T\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(010)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "(110)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (1.0, 0.0), 1: (0.0, 1.0), 2: (0.697174, 0.302826)}\n",
      "*********branch= 0F1F\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(000)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(100)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (1.0, 0.0), 1: (1.0, 0.0), 2: (0.302826, 0.697174)}\n",
      "****************************ending PRINT output\n",
      "\n",
      "*************************beginning PRINT output\n",
      "PRINT line number=14\n",
      "*********branch= 0T1T\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(011)ZL ( 0.400520 - 0.117800j)\t prob=0.174294\n",
      "(111)ZL (-0.047936 - 0.270940j)\t prob=0.075706\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (0.0, 1.0), 1: (0.0, 1.0), 2: (0.697174, 0.302826)}\n",
      "*********branch= 0T1F\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(001)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(101)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (0.0, 1.0), 1: (1.0, 0.0), 2: (0.302826, 0.697174)}\n",
      "*********branch= 0F1T\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(010)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "(110)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (1.0, 0.0), 1: (0.0, 1.0), 2: (0.697174, 0.302826)}\n",
      "*********branch= 0F1F\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(000)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(100)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (1.0, 0.0), 1: (1.0, 0.0), 2: (0.302826, 0.697174)}\n",
      "****************************ending PRINT output\n",
      "\n",
      "*************************beginning PRINT output\n",
      "PRINT line number=18\n",
      "*********branch= 0T1T\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(011)ZL (-0.047936 - 0.270940j)\t prob=0.075706\n",
      "(111)ZL ( 0.400520 - 0.117800j)\t prob=0.174294\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (0.0, 1.0), 1: (0.0, 1.0), 2: (0.302826, 0.697174)}\n",
      "*********branch= 0T1F\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(001)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(101)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (0.0, 1.0), 1: (1.0, 0.0), 2: (0.302826, 0.697174)}\n",
      "*********branch= 0F1T\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(010)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(110)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (1.0, 0.0), 1: (0.0, 1.0), 2: (0.302826, 0.697174)}\n",
      "*********branch= 0F1F\n",
      "state vector:\n",
      "ZL convention (Zero bit Last in state tuple)\n",
      "(000)ZL ( 0.047936 + 0.270940j)\t prob=0.075706\n",
      "(100)ZL (-0.400520 + 0.117800j)\t prob=0.174294\n",
      "total probability of state vector (=one if no measurements)= 0.250000\n",
      "dictionary with key=qubit, value=(Prob(0), Prob(1))\n",
      "{0: (1.0, 0.0), 1: (1.0, 0.0), 2: (0.302826, 0.697174)}\n",
      "****************************ending PRINT output\n"
     ]
    }
   ],
   "source": [
    "init_st_vec = StateVec.get_ground_st_vec(num_bits)\n",
    "sim = SEO_simulator(file_prefix, num_bits, init_st_vec)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "所有的量子比特初始态为|0>。\n",
    "\n",
    "量子线路的第1行对量子比特0做了随意选取角度的旋转。\n",
    "\n",
    "量子线路的第2行为打印输出操作。\n",
    "\n",
    "接下来我们将第二行的量子态存储为密度矩阵den_mat1，并且用Pandas数据库存储和展示这个密度矩阵。其中量子基矢仍然采用ZL(第0在最后)的惯例。\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "</style><table id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >000ZL</th>        <th class=\"col_heading level0 col1\" >001ZL</th>        <th class=\"col_heading level0 col2\" >010ZL</th>        <th class=\"col_heading level0 col3\" >011ZL</th>        <th class=\"col_heading level0 col4\" >100ZL</th>        <th class=\"col_heading level0 col5\" >101ZL</th>        <th class=\"col_heading level0 col6\" >110ZL</th>        <th class=\"col_heading level0 col7\" >111ZL</th>    </tr></thead><tbody>\n",
       "                <tr>\n",
       "                        <th id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9level0_row0\" class=\"row_heading level0 row0\" >000ZL</th>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row0_col0\" class=\"data row0 col0\" >(0.3028+0j)</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row0_col1\" class=\"data row0 col1\" >(0.05087-0.4567j)</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row0_col2\" class=\"data row0 col2\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row0_col3\" class=\"data row0 col3\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row0_col4\" class=\"data row0 col4\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row0_col5\" class=\"data row0 col5\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row0_col6\" class=\"data row0 col6\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row0_col7\" class=\"data row0 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9level0_row1\" class=\"row_heading level0 row1\" >001ZL</th>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row1_col0\" class=\"data row1 col0\" >(0.05087+0.4567j)</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row1_col1\" class=\"data row1 col1\" >(0.6972+0j)</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row1_col2\" class=\"data row1 col2\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row1_col3\" class=\"data row1 col3\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row1_col4\" class=\"data row1 col4\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row1_col5\" class=\"data row1 col5\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row1_col6\" class=\"data row1 col6\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row1_col7\" class=\"data row1 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9level0_row2\" class=\"row_heading level0 row2\" >010ZL</th>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row2_col0\" class=\"data row2 col0\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row2_col1\" class=\"data row2 col1\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row2_col2\" class=\"data row2 col2\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row2_col3\" class=\"data row2 col3\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row2_col4\" class=\"data row2 col4\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row2_col5\" class=\"data row2 col5\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row2_col6\" class=\"data row2 col6\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row2_col7\" class=\"data row2 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9level0_row3\" class=\"row_heading level0 row3\" >011ZL</th>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row3_col0\" class=\"data row3 col0\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row3_col1\" class=\"data row3 col1\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row3_col2\" class=\"data row3 col2\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row3_col3\" class=\"data row3 col3\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row3_col4\" class=\"data row3 col4\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row3_col5\" class=\"data row3 col5\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row3_col6\" class=\"data row3 col6\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row3_col7\" class=\"data row3 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9level0_row4\" class=\"row_heading level0 row4\" >100ZL</th>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row4_col0\" class=\"data row4 col0\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row4_col1\" class=\"data row4 col1\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row4_col2\" class=\"data row4 col2\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row4_col3\" class=\"data row4 col3\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row4_col4\" class=\"data row4 col4\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row4_col5\" class=\"data row4 col5\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row4_col6\" class=\"data row4 col6\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row4_col7\" class=\"data row4 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9level0_row5\" class=\"row_heading level0 row5\" >101ZL</th>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row5_col0\" class=\"data row5 col0\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row5_col1\" class=\"data row5 col1\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row5_col2\" class=\"data row5 col2\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row5_col3\" class=\"data row5 col3\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row5_col4\" class=\"data row5 col4\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row5_col5\" class=\"data row5 col5\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row5_col6\" class=\"data row5 col6\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row5_col7\" class=\"data row5 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9level0_row6\" class=\"row_heading level0 row6\" >110ZL</th>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row6_col0\" class=\"data row6 col0\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row6_col1\" class=\"data row6 col1\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row6_col2\" class=\"data row6 col2\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row6_col3\" class=\"data row6 col3\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row6_col4\" class=\"data row6 col4\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row6_col5\" class=\"data row6 col5\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row6_col6\" class=\"data row6 col6\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row6_col7\" class=\"data row6 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9level0_row7\" class=\"row_heading level0 row7\" >111ZL</th>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row7_col0\" class=\"data row7 col0\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row7_col1\" class=\"data row7 col1\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row7_col2\" class=\"data row7 col2\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row7_col3\" class=\"data row7 col3\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row7_col4\" class=\"data row7 col4\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row7_col5\" class=\"data row7 col5\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row7_col6\" class=\"data row7 col6\" >0j</td>\n",
       "                        <td id=\"T_b560b384_49ef_11ea_a949_29773a8da0f9row7_col7\" class=\"data row7 col7\" >0j</td>\n",
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7fa4a5d26510>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# density  matrix cached at line number 2 of eng & pic files\n",
    "den_mat1 = StateVec.get_den_mat(num_bits, sim.cached_sts[2])\n",
    "den_mat1_df = Plotter.get_den_mat_df(num_bits, den_mat1)\n",
    "# pan.set_option('precision', 5)\n",
    "# print(\"\\nden_mat1=\\n\", den_mat1_df)\n",
    "den_mat1_df.style.format(\"{:.4}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "之后，我们将模拟器演变的末态存储为密度矩阵den_mat2，并且用pandas数据结构存储和展示："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "</style><table id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >000ZL</th>        <th class=\"col_heading level0 col1\" >001ZL</th>        <th class=\"col_heading level0 col2\" >010ZL</th>        <th class=\"col_heading level0 col3\" >011ZL</th>        <th class=\"col_heading level0 col4\" >100ZL</th>        <th class=\"col_heading level0 col5\" >101ZL</th>        <th class=\"col_heading level0 col6\" >110ZL</th>        <th class=\"col_heading level0 col7\" >111ZL</th>    </tr></thead><tbody>\n",
       "                <tr>\n",
       "                        <th id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9level0_row0\" class=\"row_heading level0 row0\" >000ZL</th>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row0_col0\" class=\"data row0 col0\" >(0.0757+0j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row0_col1\" class=\"data row0 col1\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row0_col2\" class=\"data row0 col2\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row0_col3\" class=\"data row0 col3\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row0_col4\" class=\"data row0 col4\" >(0.0127-0.114j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row0_col5\" class=\"data row0 col5\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row0_col6\" class=\"data row0 col6\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row0_col7\" class=\"data row0 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9level0_row1\" class=\"row_heading level0 row1\" >001ZL</th>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row1_col0\" class=\"data row1 col0\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row1_col1\" class=\"data row1 col1\" >(0.0757+0j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row1_col2\" class=\"data row1 col2\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row1_col3\" class=\"data row1 col3\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row1_col4\" class=\"data row1 col4\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row1_col5\" class=\"data row1 col5\" >(0.0127-0.114j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row1_col6\" class=\"data row1 col6\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row1_col7\" class=\"data row1 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9level0_row2\" class=\"row_heading level0 row2\" >010ZL</th>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row2_col0\" class=\"data row2 col0\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row2_col1\" class=\"data row2 col1\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row2_col2\" class=\"data row2 col2\" >(0.0757+0j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row2_col3\" class=\"data row2 col3\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row2_col4\" class=\"data row2 col4\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row2_col5\" class=\"data row2 col5\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row2_col6\" class=\"data row2 col6\" >(0.0127-0.114j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row2_col7\" class=\"data row2 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9level0_row3\" class=\"row_heading level0 row3\" >011ZL</th>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row3_col0\" class=\"data row3 col0\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row3_col1\" class=\"data row3 col1\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row3_col2\" class=\"data row3 col2\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row3_col3\" class=\"data row3 col3\" >(0.0757+0j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row3_col4\" class=\"data row3 col4\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row3_col5\" class=\"data row3 col5\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row3_col6\" class=\"data row3 col6\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row3_col7\" class=\"data row3 col7\" >(0.0127-0.114j)</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9level0_row4\" class=\"row_heading level0 row4\" >100ZL</th>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row4_col0\" class=\"data row4 col0\" >(0.0127+0.114j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row4_col1\" class=\"data row4 col1\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row4_col2\" class=\"data row4 col2\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row4_col3\" class=\"data row4 col3\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row4_col4\" class=\"data row4 col4\" >(0.174+0j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row4_col5\" class=\"data row4 col5\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row4_col6\" class=\"data row4 col6\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row4_col7\" class=\"data row4 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9level0_row5\" class=\"row_heading level0 row5\" >101ZL</th>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row5_col0\" class=\"data row5 col0\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row5_col1\" class=\"data row5 col1\" >(0.0127+0.114j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row5_col2\" class=\"data row5 col2\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row5_col3\" class=\"data row5 col3\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row5_col4\" class=\"data row5 col4\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row5_col5\" class=\"data row5 col5\" >(0.174+0j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row5_col6\" class=\"data row5 col6\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row5_col7\" class=\"data row5 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9level0_row6\" class=\"row_heading level0 row6\" >110ZL</th>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row6_col0\" class=\"data row6 col0\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row6_col1\" class=\"data row6 col1\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row6_col2\" class=\"data row6 col2\" >(0.0127+0.114j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row6_col3\" class=\"data row6 col3\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row6_col4\" class=\"data row6 col4\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row6_col5\" class=\"data row6 col5\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row6_col6\" class=\"data row6 col6\" >(0.174+0j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row6_col7\" class=\"data row6 col7\" >0j</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9level0_row7\" class=\"row_heading level0 row7\" >111ZL</th>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row7_col0\" class=\"data row7 col0\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row7_col1\" class=\"data row7 col1\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row7_col2\" class=\"data row7 col2\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row7_col3\" class=\"data row7 col3\" >(0.0127+0.114j)</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row7_col4\" class=\"data row7 col4\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row7_col5\" class=\"data row7 col5\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row7_col6\" class=\"data row7 col6\" >0j</td>\n",
       "                        <td id=\"T_b5632678_49ef_11ea_a949_29773a8da0f9row7_col7\" class=\"data row7 col7\" >(0.174+0j)</td>\n",
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7fa4a5d26450>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "den_mat2 = StateVec.get_den_mat(num_bits, sim.cur_st_vec_dict)\n",
    "den_mat2_df = Plotter.get_den_mat_df(num_bits, den_mat2)\n",
    "# print(\"\\nden_mat2=\\n\", den_mat2_df)\n",
    "den_mat2_df.style.format(\"{:.3}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "更直观的，密度矩阵也可以通过quiver画图被表示为向量箭头的形式。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP4AAAD3CAYAAAA9memZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deVxU9foH8M8MA8gmi8qmJoU4oCAIJKkIAiJqkZqZ5oLZ1VRcSH+4YG6gmGihP3G7LlFm/jQXSM3CXG+5W+rFDMWNRWAQBNlnmOH7+4PLXIltlgMDzPN+vXi9YGbOcx6Wh3Nm5pzP4THGGAghWoWv6QYIIS2PBp8QLUSDT4gWosEnRAvR4BOihWjwCdFCNPiEaCEa/BawdOlSbNq0SdNtECJHg09qEQqFSEtLk399+/ZtTJs2Df3798dbb72F+fPnIzc3V4MdEi7Q4JNGvXz5Eh988AHOnTuH8+fPw8jICBEREZpui6iJBr8Z3Lt3D2PGjEG/fv3w6aefQiwWy+87f/48Ro0aBU9PT0yYMAEpKSny+/z9/bF3714EBwfDw8OjzrL1uXbtGnx8fLB7924MGDAA3t7eOHPmDC5evIigoCD0798fO3fulD/+3//+N8aPHw9PT094e3sjKioKEokEADBp0iQAwKhRo9CvXz+cOnUKvr6+GDFiBIyNjWFgYIDJkyfjjz/+4PLHRTSBEU6JxWI2ZMgQFh8fzyQSCfvpp59Y7969WWxsLLt79y5766232O3bt5lUKmXHjh1jfn5+TCwWM8YY8/PzY2PHjmU5OTmsoKCADR8+nB04cKDR9V29epU5OTmxuLg4J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R4+iqKio6Qe+QiwWIzo6GlVVVbCzs0NgYCCGDh0KLy8vzna1NU3hwReJRAgKCsL58+eVfrGJMveoXluq98cfN/Hvf9+Br68f7Oxel7/GolWZezUSEhLg6+tLrzCTds/d3RPu7upfpqo1U/h9/ISEhHoPRSSEtD0Kb/GTkpKasw9CSAuiI/cI0UI0+IRoIRp8QrQQDT4hWogGnxAtRINPiBaiwSdEC9HgE6KFaPAJ0UI0+IRoIRp8QrQQDT4hWogGnxAtRINPiBZqkQtq8PncpsRSPaqniXpc96VJSmXuEULaB9rVJ0QL0eATooVo8AnRQjT4hGghGnxCtBANPiFa6P8BsrSLnKAKBaEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "Plotter.plot_phasors(['den_mat2'], den_mat_df_list=[den_mat2_df])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "接下来将密度矩阵den_mat2中的值替换为模，并且将数据输出：\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>000ZL</th>\n",
       "      <th>001ZL</th>\n",
       "      <th>010ZL</th>\n",
       "      <th>011ZL</th>\n",
       "      <th>100ZL</th>\n",
       "      <th>101ZL</th>\n",
       "      <th>110ZL</th>\n",
       "      <th>111ZL</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>000ZL</th>\n",
       "      <td>0.075706</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.114870</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>001ZL</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.075706</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.114870</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>010ZL</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.075706</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.114870</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>011ZL</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.075706</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.114870</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100ZL</th>\n",
       "      <td>0.114870</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.174294</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101ZL</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.114870</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.174294</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110ZL</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.114870</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.174294</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>111ZL</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.114870</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.174294</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          000ZL     001ZL     010ZL     011ZL     100ZL     101ZL     110ZL  \\\n",
       "000ZL  0.075706  0.000000  0.000000  0.000000  0.114870  0.000000  0.000000   \n",
       "001ZL  0.000000  0.075706  0.000000  0.000000  0.000000  0.114870  0.000000   \n",
       "010ZL  0.000000  0.000000  0.075706  0.000000  0.000000  0.000000  0.114870   \n",
       "011ZL  0.000000  0.000000  0.000000  0.075706  0.000000  0.000000  0.000000   \n",
       "100ZL  0.114870  0.000000  0.000000  0.000000  0.174294  0.000000  0.000000   \n",
       "101ZL  0.000000  0.114870  0.000000  0.000000  0.000000  0.174294  0.000000   \n",
       "110ZL  0.000000  0.000000  0.114870  0.000000  0.000000  0.000000  0.174294   \n",
       "111ZL  0.000000  0.000000  0.000000  0.114870  0.000000  0.000000  0.000000   \n",
       "\n",
       "          111ZL  \n",
       "000ZL  0.000000  \n",
       "001ZL  0.000000  \n",
       "010ZL  0.000000  \n",
       "011ZL  0.114870  \n",
       "100ZL  0.000000  \n",
       "101ZL  0.000000  \n",
       "110ZL  0.000000  \n",
       "111ZL  0.174294  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = den_mat2_df.apply(lambda x : np.sqrt((x*np.conj(x)).to_numpy().real))\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "此数据全部由非零的数据构成，所以可以通过seaborn工具包用heatmap表示："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEjCAYAAADQeG38AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3df1TUdb4/8OfMgGXZhKDioG5m6w9U3Cy0OiKlqLCIIhhLF0uzs3hqEQ6wltxsQVr2nuZsVFfdtqXdSE9QXhaSC8w6c2UXr3Ju3du5pRmaxhclkR/BSIiW2sf39w8vEzjMD4Yf82bm+bjnc47z+bzn8359PtudF5/3r49KCCFAREReTe3uAIiIyP2YDIiIiMmAiIiYDIiICEwGREQEJgMiIgKTgdfJysrC66+/7u4wvN6///u/45lnnhmy85WVleGf/umfhux85H2YDEhqs2fPxrlz5yyfP/vsM2zevBmLFy/Gww8/jLS0NLS1tbkxQtesXbsW77zzjuXzrddJNNKYDGhU+fbbb/GLX/wCf//73/GPf/wDd955J/75n//Z3WERjXpMBh6urq4OcXFxWLhwIdLT03H16tU+x//xj38gNjYWoaGheOKJJ3Dq1CnLseXLl+Mvf/kL1qxZgwcffLDf79/q448/Rnh4ON5++2088sgjCAsLw6FDh3D48GFERkZi8eLFeOuttyzljx8/jsTERISGhiIsLAwvv/wyrl27BgDYsGEDACA2NhYLFy6EwWDAo48+ip///OcYN24cxo4diyeffBL/+7//6/T9WL58Of785z9jzZo1uP/++/Hiiy+ivb0dv/zlL7Fw4UI8/fTT+Pbbby3l09LSsGTJEjz44IPYsGEDzpw5Yzl28eJFPPvss3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kJycjBdffBGhoaEOy/c2YcKEPrH0/nz77bfjypUrAG7+6L7++us4ePAgzGYz1OqbfztdvHgR33//PX744QfodDrLd3v/u8et96/nugfDbDZb1d37f9empiYcP368z31RFAVr164ddN3kuZgMPNjEiRPR2toKIYQlIVy4cAHTpk0DcPPH69lnn8Vzzz3nthh37tyJuXPnIj8/H+PGjcO7777r8C/YpqYmbN68Gb/61a/6/Wt8qFRUVKC6uhqFhYWYOnUqLl26hEWLFkEIAX9/f/j4+KClpQX33nsvAKC5uXnI6h47diy+//57y+dvvvnG8u+eupubm3HfffdZ1a3T6bBo0SIUFhYOWTzk+dhM5MF6ml/27duHH374ASaTCZ9//rnleEJCAj744AMcO3YMQghcuXIFNTU16O7uHrEYL1++jDvvvBN33nkn6uvr8f777/c5PmHCBHz99deWz62trdi0aROSkpKGfVz95cuXMWbMGIwfPx7fffcdXnvtNcsxjUaDlStXYs+ePfjuu+9QX1+P8vJyl+u69TrnzJmDM2fO4OTJk7h69Sp2795ts+6vvvoKH374oeX4Y489hrNnz+LAgQO4fv06rl+/juPHj6O+vt7l+MjzMRl4sDFjxmD37t348MMPsWjRIhgMBqxcudJyPCQkBL/97W/x8ssvY9GiRVi1ahXKyspGNMbt27ejsrISDzzwAH7zm98gOjq6z/GtW7ciKysLoaGhMBgMKCkpwddff40//OEPWLhwoWUbDuvWrUNQUBCWLl2K1atX4/777+9zPDs7G5cuXcKSJUvwwgsvYPXq1RgzZoxLdd16nffeey9SUlLw9NNPY9WqVXjwwQet6r5y5QqWLFmCrKwsxMfHW46NGzcOf/nLX2AwGLB06VKEhYXh1VdftYzSIuqPSgi+3IZoKPz+979He3s79Hq9u0MhGjA+GRC5qL6+HqdOnYIQAsePH8df//rXPk9eRKOJUx3IDQ0NyMrKQmdnJ/z8/KDX6zF9+nSb++19p7q6Grt27epz/o6ODgghUFtbi7KyMtTU1FiVIXm89dZb+NOf/mS1/8EHH8Sf//xnN0TkHpcvX8avf/1rtLW1ISAgAM888wwiIiLcHRa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rGxsfjjH/84IjHExMRgypQp/Y6I6OzsHJEYeurivbhJhsQIyJEceS+8h1cnAz8/P1RWVmL16tWWEQlCCFRUVECr1Y5IDFOmTEFxcTECAwOtjj366KMjEgPAe9GbDIkRkCM58l54D69OBq+88gpycnLw8ssvW36AWltbMWfOHLzyyisjEsOqVavQ1NTU7w/gypUrRyQGgPeiNxkSIyBHcuS98B5e3YHcw2w2o7m5GQCg0+ng7+/v5ojch/cCOHv2LHJycnDy5EmrxLhz507MmDFjROLQ6/VYuXIlHnjgAatjeXl5eOmll4Y9Bt4L78FkADlGSsgQA/XFxPgj3gvP59XNRDKMlJAhBkdkGK3hjhhUKpWl09Sds1xl+EPB39+fCcDDeXUykGGkhAwxAHKM1pAhBkCeBC1LHLbI8EeCTHGMdl6dDGQYKSFDDIAcozVkiAGQJ0HLEIcsCVqWODyZVycDGUZKyBADIMdoDRliAORJ0DLEIUuCliUOT+bVyaBnOGVubi4mT54MIQRaW1sRHBw8YsMpZYgBkGNYpwwxAPIkaBnikCVByxKHJ+NoIgAdHR1oaWmBSqXC5MmT3dJRJkMMgBydle6OQZbhlDLEIcuQTlni8GRenQx6OuhOnjyJSZMmQQiBb775BsHBwSM+msidMfSOgyOrfiTLcEpZ4iAPNxJLo8oqMTFRlJeXC0VRLPsURREHDhwQv/jFL7wmBlnikCEGR2JiYtwdghBCjjhkiEEIeeIY7by6z0CGDjoZYpAlDhliAGyPXBFCSDGCZiTjkGUUjyxxeDKvTgYydNDJEIMsccgQAyDPyBUZ4pAhBpni8GRe3WcgQwedDDHIEocMMQBARESE3ZErhw8f9po4ZIhBpjg8mVc/GUyfPh179+51awedDDHIEocMMQDyDHGVIQ4ZYpApDk/m1U8GRER0k9rdARARkfsxGRAREZMBERExGRAREYD/Dwi8EJAEL7QaAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.close('all')\n",
    "ax = sea.heatmap(df, cmap=\"YlGnBu\")\n",
    "ax.set_title('den_mat2  magnitude')\n",
    "plt.yticks(rotation=0) \n",
    "plt.xticks(rotation=90)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "密度矩阵$\\rho$的非纯度由$ abs({\\rm tr}(\\rho^2) - 1 )$ 定义。当密度矩阵$\\rho$为纯态时此值为零。而目前模拟器的末态den_mat2并非一个纯态。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "impurity of den_mat2= 0.75\n"
     ]
    }
   ],
   "source": [
    "print(\"impurity of den_mat2=\", StateVec.get_impurity(den_mat2))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下一步我们对密度矩阵关于比特0和1求迹，并得到约化密度矩阵tr01_den_mat2.此约化密度矩阵也可以通过dataframe展示出来。可以看到，初始的量子比特0的密度矩阵den_mat1已经被成功的转移到量子比特2的密度矩阵tr01_den_mat2，意味着量子态成功的从比特0传输到比特2."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "</style><table id=\"T_b5b155a0_49ef_11ea_a949_29773a8da0f9\" ><thead>    <tr>        <th class=\"blank level0\" ></th>        <th class=\"col_heading level0 col0\" >0</th>        <th class=\"col_heading level0 col1\" >1</th>    </tr></thead><tbody>\n",
       "                <tr>\n",
       "                        <th id=\"T_b5b155a0_49ef_11ea_a949_29773a8da0f9level0_row0\" class=\"row_heading level0 row0\" >0</th>\n",
       "                        <td id=\"T_b5b155a0_49ef_11ea_a949_29773a8da0f9row0_col0\" class=\"data row0 col0\" >(0.3028+0j)</td>\n",
       "                        <td id=\"T_b5b155a0_49ef_11ea_a949_29773a8da0f9row0_col1\" class=\"data row0 col1\" >(0.05087-0.4567j)</td>\n",
       "            </tr>\n",
       "            <tr>\n",
       "                        <th id=\"T_b5b155a0_49ef_11ea_a949_29773a8da0f9level0_row1\" class=\"row_heading level0 row1\" >1</th>\n",
       "                        <td id=\"T_b5b155a0_49ef_11ea_a949_29773a8da0f9row1_col0\" class=\"data row1 col0\" >(0.05087+0.4567j)</td>\n",
       "                        <td id=\"T_b5b155a0_49ef_11ea_a949_29773a8da0f9row1_col1\" class=\"data row1 col1\" >(0.6972+0j)</td>\n",
       "            </tr>\n",
       "    </tbody></table>"
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x7fa4a4e3d350>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tr01_den_mat2 = StateVec.get_partial_tr(num_bits, den_mat2, {0, 1})\n",
    "tr01_den_mat2_df = Plotter.get_den_mat_df(1, tr01_den_mat2)\n",
    "# print(\"\\ntr01_den_mat2=\\n\", tr01_den_mat2_df)\n",
    "tr01_den_mat2_df.style.format(\"{:.4}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以验证，密度矩阵tr01_den_mat2 描述一个和初始态同样的纯态。其非纯度为0："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "impurity of tr01_den_mat2= 2.220446049250313e-16\n"
     ]
    }
   ],
   "source": [
    "print(\"impurity of tr01_den_mat2=\", StateVec.get_impurity(tr01_den_mat2))"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {
    "height": "12px",
    "width": "252px"
   },
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": "block",
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
